const mongoose =  require('mongoose')

const ArticleSchema = new mongoose.Schema({
    category: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Category'
    },
    userId: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'User'
    },
    title: {
        type: String,
    },
    intro: { // 简介
        type: String,
    },
    content: {
        type: String
    },
    click: {
        type: Number
    },
    privacy: { // 该博客是否可见
        type: Boolean,
        default: true
    },
    createAt: {
        type: Date,
        default: Date.now
    }
})


const ArticleModel = mongoose.model('Article', ArticleSchema);

module.exports = ArticleModel;